package com.fzhucc.modules.businessCard.rest;

import com.fzhucc.annotation.AnonymousAccess;
import com.fzhucc.annotation.Log;
import com.fzhucc.modules.businessCard.domain.dto.BusinessCardStatusLoveDto;
import com.fzhucc.modules.businessCard.domain.dto.BusinessCardStatusQueryCriteria;
import com.fzhucc.modules.businessCard.service.BusinessCardStatusService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
* @author yyg
* @date 2022-10-24
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "名片：收藏管理")
@RequestMapping("/api/businessCardStatus")
public class BusinessCardStatusController {

    private final BusinessCardStatusService businessCardStatusService;

    @GetMapping
    @Log("查询businessCardStatus")
    @ApiOperation("查询businessCardStatus")
    //@PreAuthorize("@el.check('businessCardStatus:list')")
    public ResponseEntity<Object> queryBusinessCardStatus(BusinessCardStatusQueryCriteria criteria, Pageable pageable){
        return new ResponseEntity<>(businessCardStatusService.queryAll(criteria,pageable),HttpStatus.OK);
    }

    @PostMapping(value = "/love")
    @Log("收藏businessCardStatus")
    @ApiOperation("收藏businessCardStatus")
    public ResponseEntity<Object> loveBusinessCardStatus(@Validated @RequestBody BusinessCardStatusLoveDto resources){
        return new ResponseEntity<>(businessCardStatusService.love(resources),HttpStatus.OK);
    }

}